package com.zhss.springbootdemo01.domain;


import com.zhss.springbootdemo01.validate.Age;
import lombok.Getter;
import lombok.Setter;
import lombok.Singular;
import lombok.ToString;
import org.hibernate.validator.constraints.Range;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Size;

/**
 * @ClassName User
 * @Description TODO
 * @Author leejiliang
 * @DateTime 2021/2/6 18:02
 * @Version 1.0
 */

@Getter
@Setter
@ToString
public class User {

	public interface Save{}
	public interface Update{}

	@Null(groups = {Save.class})
	@NotNull(groups = {Update.class})
	private Long id;

	@Size(min = 2, max = 20, groups = {Save.class, Update.class})
	private String name;

//	@Range(min = 18, max = 70, groups = {Save.class, Update.class})
	@Age(min = 1, max = 20, groups = {Save.class, Update.class})
	private Integer age;
}
